package org.reliablesource.prism.gef.view;

import org.eclipse.draw2d.ButtonModel;
import org.eclipse.draw2d.ChangeEvent;
import org.eclipse.draw2d.ChangeListener;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.ToggleModel;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
import org.reliablesource.prism.gef.editor.figures.ThumbnailFigure;

/**
 * 
 * ThumbnailViewPart.java Copyright (c) 2006, Reliable Source, Inc. All Rights
 * Reserved
 * 
 * Created on: Apr 11, 2006
 * 
 * @author Dennis Park <a
 *         href="mailto:dennis.park@gmail.com">dennis.park@gmail.com</a>
 * 
 */

public class ThumbnailViewPart extends ViewPart {
	
	public void createPartControl(Composite parent) {
		final Label label = new Label("Press a button");
		Canvas base = new Canvas(parent, SWT.NONE);
		LightweightSystem lws = new LightweightSystem(base);
		Figure baseFigure = new Figure();
		baseFigure.setLayoutManager(new XYLayout());
		lws.setContents(baseFigure);

		ThumbnailFigure above = new ThumbnailFigure();
		above.add(label);
		baseFigure.add(above, new Rectangle(75, 75, 135, 135));

		ButtonModel aModel = new ToggleModel();
		aModel.addChangeListener(new ChangeListener() {
			public void handleStateChanged(ChangeEvent event) {
				label.setText("button pressed - above");
			}
		});
		above.setModel(aModel);
	}

	
	public void setFocus() {

	}

	public void dispose() {

	}

}
